//
// Created by kaifa on 2024-02-05.
//

#include <string>
#include <locale>
#include <codecvt>

#ifndef SCVZERNG_TOOLS_STRINGUTILS_H
#define SCVZERNG_TOOLS_STRINGUTILS_H
std::string wideStringToUtf8(const std::wstring& wideStr) {
    // 创建一个用于转换的本地化环境
    std::wstring_convert<std::codecvt_utf8<wchar_t>> conv;

    // 转换宽字符串为UTF-8编码的字符串
    return conv.to_bytes(wideStr);
}
#endif //SCVZERNG_TOOLS_STRINGUTILS_H
